import { http } from "@/utils/http";
import { Result, arrayResult } from "../types";

type Search = {
  name: string,
  pageNumber: number,
  pageSize: number,
  sortName: string,
  sortType: number
}

type data = {
    id?: number;
    name?: string;
    code?: string;
    status?: number;
    ip?: string;
    port?: number;
    number?: string;
    note?: string;
    detailList?: any;
}

// 电梯列表
export const elevatorList = (params?: Search) => {
  return http.request<Result>("get", "/api/elevator/List", { params });
};

// 新增电梯
export const addElevator = (data?: data) => {
  return http.request<Result>("post", "/api/elevator/Add", { data });
};

// 修改电梯
export const updateElevator = (data?: data) => {
  return http.request<Result>("post", "/api/elevator/Update", { data });
};

// 删除电梯
export const delElevator = (id: number) => {
  return http.request<Result>("post", `/api/elevator/Delete/${id}`, {});
};

// 电梯详情
export const getElevator = (id: number) => {
  return http.request<any>("get", `/api/elevator/Get/${id}`);
};